package com.fjnu.dao.impl;

import com.fjnu.annotation.PerformanceMonitor;
import com.fjnu.dao.UserDao;
import com.fjnu.model.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Slf4j
@PerformanceMonitor
public class UserDaoImpl implements UserDao  {


    @Override
    public int insert(User user) {
        return 0;
    }

    @Override
    public int delete(String userId) {
        return 0;
    }

    @Override
    public int update(String userId, User user) {
        return 0;
    }

    @PerformanceMonitor(alarmedTime = 500)
    @Override
    public User selectUserByNameAndPassword(String userId, String password) {
        try {
            Thread.sleep(1000);
        } catch (Exception e) {
            log.error("selectUserByNameAndPassword error:{}", e.getMessage()) ;
        }
        return null;
    }

    @PerformanceMonitor(alarmedTime = 2000)
    @Override
    public List<User> selectUserByRole(String roleId) {
        try {
            Thread.sleep(1000);
        } catch (Exception e) {
            log.error("selectUserByNameAndPassword error:{}", e.getMessage()) ;
        }
        return null;
    }

}
